<%@ page import="com.online_video.entity.User" %><%--
  Created by IntelliJ IDEA.
  User: 郑厚文
  Date: 2022/3/17
  Time: 23:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!--导航条-->
<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false"
                    aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="index.jsp">在线视频网站</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li class="active" id="indexActive"><a href="./index.jsp" id="indexhref">首页</a></li>
                <li id="historyActive"><a href="history.jsp" id="historyhref">历史</a></li>
                <li id="collectionActive"><a href="collection.jsp" id="collectionhref">收藏</a></li>
                <li id="uploadActive"><a href="upload.jsp" id="uploadhref">上传视频</a></li>

            </ul>

            <ul class="nav navbar-nav center">
                <li>
                    <div class="row row-search">
                        <div class="col-lg-6">
                            <div class="input-group">
                                <input type="text" class="form-control" id="viName" placeholder="Search for...">
                                <span class="input-group-btn">
											<button id="searchBtn" class="btn btn-default" type="button"><a
                                                    href="#">GO!</a></button>
										</span>
                            </div><!-- /input-group -->
                        </div><!-- /.col-lg-6 -->
                    </div><!-- /.row -->
                </li>
            </ul>

            <ul class="nav navbar-nav navbar-right">
                <%
                    if (user == null) {
                %>
                <li><a href="#"><img src="../webImg/225默认头像.png" class="notPhoneImg img-circle" id="show"></a></li>
                <li><a id="registerOrInfo" href="#">注册</a></li>
                <li><a id="loginOrExit" href="#">登录</a></li>
                <%
                } else {
                %>
                <li><a href="#"><img src="/online_video/img/<%=user.getHeadportrait()==null?"225默认头像.png":user.getHeadportrait()%>" class="notPhoneImg img-circle" id="show"></a></li>
                <li><a id="registerOrInfo" href="#"><%=user.getNickname()%></a></li>
                <li><a id="loginOrExit" href="#">退出</a></li>
                <%
                    }
                %>
<%--                <li><a href="../navbar/"><img src="../webImg/bg.jpeg" class="notPhoneImg img-circle" id="show"></a></li>--%>
                <%--                <li><a id="registerOrInfo" href="#"><%=user.getNickname() != null ? user.getNickname() : "注册"%>--%>
                <%--                </a></li>--%>
                <%--                <li><a href="./login.jsp"><%=user == null ? "登录" : "退出"%>--%>
                <%--                </a></li>--%>
            </ul>
        </div>
        <!--/.nav-collapse -->
    </div>
</nav>

<!-- 个人信息显示 -->
<div class="row" id="menu" style="display: none">
    <div class="col-sm-6 col-md-4 col-lg-6">
        <div class="thumbnail">
            <%
                if (user != null) {
            %>
            <img src="/online_video/img/<%=user.getHeadportrait()==null?"225默认头像.png":user.getHeadportrait()%>" class="img-thumbnail" alt="..." style="height: 60px;width: 60px;">
            <div class="caption" style="margin-left:70px;">
                <h3>姓名：<%=user.getNickname()%>
                </h3>
                <h4>账号：<%=user.getUsername()%>
                </h4>
                <h4>电话：<%=user.getTelephone()%>
                </h4>
                <h4>邮箱：<%=user.getEmail()%>
                </h4>
            </div>
            <%
            } else {
            %>
            请先登入
            <%
                }
            %>

        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        var $show = $('#show');
        var $menu = $('#menu');
        $show.mouseover(function () {
            $menu.css("display", "block")
        });

        $menu.mouseover(function () {
            $menu.css("display", "block")
        })

        $menu.mouseleave(function () {
            $menu.css("display", "none")
        })

    })
</script>

<script type="text/javascript">
    $(function () {
        if (window.location.pathname == "/online_video/client/index.jsp") {
            $('#indexActive').attr("class", "active");
        } else {
            $('#indexActive').attr("class", "");
        }

        if (window.location.pathname == "/online_video/client/history.jsp") {
            $('#historyActive').attr("class", "active");
        } else {
            $('#historyActive').attr("class", "");
        }

        if (window.location.pathname == "/online_video/client/collection.jsp") {
            $('#collectionActive').attr("class", "active");
        } else {
            $('#collectionActive').attr("class", "");
        }

        if (window.location.pathname == "/online_video/client/upload.jsp") {
            $('#uploadActive').attr("class", "active");
        } else {
            $('#uploadActive').attr("class", "");
        }
    })
</script>

<script type="text/javascript">
    $(function () {
        $('#searchBtn').click(function () {
            var parm = $('#viName').val()
            location.href = "./video.do?action=page&category=&parm=" + parm;
        })

        $('#registerOrInfo').click(function () {
            if ($('#registerOrInfo').text() == "注册") {
                location.href = "./register.html";
            }else {
                location.href = "./user_info.jsp";
            }
        })

        $('#loginOrExit').click(function () {
            if ($('#loginOrExit').text() == "登录") {
                location.href = "./login.jsp";
            }else {
                location.href = "./user.do?action=exit";
            }
        })
    })
</script>
